<template>
  <div class="announcement-card">
    <!-- 装饰元素 -->
    <div class="card-decorations">
      <div class="decoration-triangle triangle-1"></div>
      <div class="decoration-triangle triangle-2"></div>
      <div class="decoration-wave"></div>
    </div>
    <div class="card-header">
      <el-icon class="header-icon"><Bell /></el-icon>
      <h3 class="header-title">公告栏</h3>
      <div class="header-decoration"></div>
    </div>

    <div class="announcement-list">
      <div
          v-for="(item, index) in announcements"
          :key="index"
          class="announcement-item"
      >
        <el-icon class="item-icon"><InfoFilled /></el-icon>
        <div class="item-content">
          <div class="item-title">{{ item.title }}</div>
          <div class="item-date">{{ item.date }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { Bell, InfoFilled } from '@element-plus/icons-vue'

const props = defineProps(['blogInfo']);

const announcements = [
  {
    title: '网站改版啦！焕然一新的博客和你见面啦 ✨',
    date: '2024-01-01'
  },
  {
    title: '新增了文章分类功能，快来看看吧 📚',
    date: '2024-01-05'
  }
]
</script>

<style scoped lang="scss">
@import '@/assets/styles/variables.scss';

.announcement-card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 25px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(227, 242, 253, 0.3);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-rainbow);
    transition: height 0.3s ease;
  }
  
  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  }
  
  &:hover::before {
    height: 6px;
  }
}

.card-decorations {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.decoration-triangle {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  animation: triangleFloat 5s ease-in-out infinite;
}

.triangle-1 {
  top: 15px;
  right: 15px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 12px solid rgba(255, 107, 107, 0.2);
  animation-delay: 0s;
}

.triangle-2 {
  bottom: 20px;
  left: 20px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 10px solid rgba(78, 205, 196, 0.2);
  animation-delay: 2s;
}


.decoration-wave {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 30px;
  height: 3px;
  background: var(--bg-decoration);
  border-radius: 2px;
  animation: waveFlow 3s ease-in-out infinite;
}

@keyframes triangleFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
    opacity: 0.4;
  }
  50% {
    transform: translateY(-8px) rotate(180deg);
    opacity: 0.8;
  }
}


@keyframes waveFlow {
  0%, 100% {
    transform: scaleX(1);
    opacity: 0.4;
  }
  50% {
    transform: scaleX(1.3);
    opacity: 0.7;
  }
}

.card-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  gap: 10px;
  position: relative;
  z-index: 2;
}

.header-decoration {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--bg-decoration), transparent);
  margin-left: 15px;
  border-radius: 2px;
  animation: headerGlow 2s ease-in-out infinite;
}

@keyframes headerGlow {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.8;
  }
}

.header-icon {
  font-size: 1.6rem;
  color: #ff6b6b;
  animation: bell-shake 2s infinite;
}

@keyframes bell-shake {
  0%, 100% {
    transform: rotate(0);
  }
  20%, 60% {
    transform: rotate(15deg);
  }
  40%, 80% {
    transform: rotate(-15deg);
  }
}

.header-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
}

.announcement-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.announcement-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(33, 150, 243, 0.05);
  transition: all 0.3s;
  animation: slide-in 0.5s ease-out forwards;
  opacity: 0;
  transform: translateX(-20px);
}

@keyframes slide-in {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.announcement-item:hover {
  background: rgba(33, 150, 243, 0.1);
  transform: translateX(5px);
}

.item-icon {
  color: #f9ca24;
  font-size: 1.2rem;
  margin-top: 3px;
}

.item-content {
  flex: 1;
}

.item-title {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 5px;
  line-height: 1.4;
  font-weight: 500;
}

.item-date {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* Hover effect for items */
.announcement-item:hover .item-icon {
  animation: bounce 0.5s;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}
</style>
